#import "YearningTonicCell.h"


@implementation YearningTonicCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
	self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
	if (self) {

		self.selectionStyle = UITableViewCellSelectionStyleNone;
		//self.contentView.backgroundColor = UIColor.whiteColor;

		//: 初始化UI布局
		[self windfallAlchemyYonderLayout];
	}
	return self;
}

- (void)setOracle:(YearningTonicModel *)oracle {
	_oracle = oracle;

	//: 配置cell的UI

	self.windfallLabel.text = [NSString stringWithFormat:@"Count: %lu", (unsigned long)oracle.curiousEcho.count];





	if (oracle.curiousEcho.count > 0) {
		[self.inspireImageView sd_setImageWithURL:[NSURL URLWithString:oracle.curiousEcho[0]] placeholderImage:nil];
	}

}
- (UIImageView *)brightenCuriousImageView {
	if (!_brightenCuriousImageView) {
	
        _brightenCuriousImageView = [[UIImageView alloc] init];
        _brightenCuriousImageView.contentMode = UIViewContentModeScaleAspectFill;
        _brightenCuriousImageView.clipsToBounds = YES;
        _brightenCuriousImageView.layer.cornerRadius = 10;
        _brightenCuriousImageView.layer.masksToBounds = YES;
        _brightenCuriousImageView.frame = CGRectMake(47, 10, 165, 194);
        UIImage *jelly = [UIImage imageNamed:@"images/image_2.png"];
        if (jelly) {
	        _brightenCuriousImageView.image = jelly;
        }
	}
	return _brightenCuriousImageView;
}

- (UITextField *)flourishTextField {
	if (!_flourishTextField) {
	
        _flourishTextField = [[UITextField alloc] initWithFrame:CGRectZero];
        _flourishTextField.frame = CGRectMake(21, 0, 149, 179);
	}
	return _flourishTextField;
}

//: 设置self.inspireImageView的圆角
+ (void)ripple:(UIImageView *)kaleidoscopeLuminous reverie:(CGFloat)thriveWhimsyRebirth {
	kaleidoscopeLuminous.layer.cornerRadius = thriveWhimsyRebirth;
	kaleidoscopeLuminous.layer.masksToBounds = YES;
}

- (void)windfallAlchemyYonderLayout {

    //: 描述_0
    self.cascadeOpusKingdomView = [[UIView alloc] init];
    self.cascadeOpusKingdomView.frame = CGRectMake(39, 40, 81, 163);
    [self.contentView addSubview:self.cascadeOpusKingdomView];


    //: 描述_1
    UILabel *oasisDrift = [[UILabel alloc] init];
    oasisDrift.size = CGSizeMake(53, 82);
    oasisDrift.left = 17;
    oasisDrift.top = 9;
    oasisDrift.text = @"label_1";
    oasisDrift.font = [UIFont systemFontOfSize:15 weight:UIFontWeightBold];
    oasisDrift.textColor = [UIColor colorWithRed:46/255.0 green:146/255.0 blue:52/255.0 alpha:0.7];
    oasisDrift.textAlignment = NSTextAlignmentRight;
    oasisDrift.numberOfLines = 3;
    self.windfallLabel = oasisDrift;
    [self.contentView addSubview:oasisDrift];

	//: 描述_2
	[self.contentView addSubview:self.brightenCuriousImageView];

	//: 描述_3
	[self.contentView addSubview:self.flourishTextField];


    //: 描述_4
    UIImageView *leapfrogZestZealot = [UIImageView new];
    leapfrogZestZealot.contentMode = UIViewContentModeScaleAspectFill;
    leapfrogZestZealot.clipsToBounds = YES;
    leapfrogZestZealot.layer.cornerRadius = 1;
    leapfrogZestZealot.layer.masksToBounds = YES;
    leapfrogZestZealot.frame = CGRectMake(38, 41, 163, 91);
    UIImage *serene = [UIImage imageNamed:@"images/image_4.png"];
    if (serene) {
	    leapfrogZestZealot.image = serene;
    }
    self.velvetImageView = leapfrogZestZealot;
    [self.contentView addSubview:leapfrogZestZealot];


    //: 描述_5
    UIView *conquerGlowCurious = [[UIView alloc] initWithFrame:CGRectZero];
    conquerGlowCurious.size = CGSizeMake(177, 110);
    conquerGlowCurious.left = 5;
    conquerGlowCurious.top = 38;
    self.euphoriaBrightenOasisView = conquerGlowCurious;
    [self.contentView addSubview:conquerGlowCurious];


    //: 描述_6
    self.inspireImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    self.inspireImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.inspireImageView.clipsToBounds = YES;
    //: UIImageView的骚操作 充数
    [YearningTonicCell ripple:self.inspireImageView reverie:14];
    UIImage *questFablePeaceful = [UIImage imageNamed:@"images/image_6.png"];
    if (questFablePeaceful) {
	    self.inspireImageView.image = questFablePeaceful;
    }
    [self.contentView addSubview:self.inspireImageView];
	[self.inspireImageView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.width.mas_equalTo(125);
		make.height.mas_equalTo(34);
		make.top.equalTo(@(10));
	}];
}


@end